package ${convertPackage};

import ${package.Entity}.${entity};
import ${dtoPackage}.${entity}DTO;
import ${voPackage}.${entity}VO;
import cn.com.blueInfo.bpm.common.convert.BaseConvert;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
* ${table.comment!} 对象转换
* @author ${author}
* @since ${date}
*/
@Mapper(componentModel = "spring")
public interface ${entity}Convert
        extends BaseConvert<${entity}, ${entity}DTO, ${entity}VO> {

    @Mapping(source = "status", target = "status", qualifiedByName = "codeToStatus")
    ${entity} dtoToEntity(${entity}DTO dto);

    // TODO: 若字段名/类型不一致，添加@Mapping注解，示例：
    // @Mapping(source = "entityName", target = "dtoName")
    // @Mapping(source = "createTime", target = "createTimeStr", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Mapping(source = "status", target = "status", qualifiedByName = "enumToDesc")
    @Mapping(source = "deleted", target = "deleted", qualifiedByName = "enumToDesc")
    @Mapping(source = "deleteTime", target = "deleteTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Mapping(source = "updateTime", target = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
    ${entity}VO entityToVO(${entity} entity);

}